package cn.outsourcing.supermarket.converter;

import cn.outsourcing.supermarket.converter.transform.BooleanToIntegerTransform;
import cn.outsourcing.supermarket.po.HiolabsGoodsGallery;
import cn.outsourcing.supermarket.vo.backstage.BackstageGalleryDataVO;
import cn.outsourcing.supermarket.vo.hiolabs.HiolabsGalleryVO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;

import java.util.List;

/**
 * 商品画廊转化器
 *
 * @author gzkemays
 * @since 2021/10/22 15:46
 */
@Mapper(uses = {BooleanToIntegerTransform.class})
public interface HiolabsGoodsGalleryConverter {
  HiolabsGoodsGalleryConverter INSTANCE = Mappers.getMapper(HiolabsGoodsGalleryConverter.class);

  /**
   * 转化为自身值对象
   *
   * @param gallery 原 po 对象
   * @return 自身VO
   */
  HiolabsGalleryVO convertToVo(HiolabsGoodsGallery gallery);
  /**
   * 转化为自身值列表对象
   *
   * @param gallery 原 po 列表对象
   * @return 自身VO
   */
  List<HiolabsGalleryVO> convertToVoList(List<HiolabsGoodsGallery> gallery);

  /**
   * 获取后台画廊的数据值对象
   *
   * @param gallery 原 po 类
   * @return 后台画廊的数据值对象
   */
  @Mapping(source = "gallery.imgUrl", target = "url")
  BackstageGalleryDataVO convertToBackstageGalleryDataVo(HiolabsGalleryVO gallery);

  /**
   * 后台画廊数据转换为原值对象
   *
   * @param gallery 画廊数据
   * @return 原值对象
   */
  @Mapping(source = "gallery.url", target = "imgUrl")
  HiolabsGalleryVO convertBackstageToVo(BackstageGalleryDataVO gallery);
  /**
   * 后台画廊数据转换为原值对象list
   *
   * @param gallery 画廊数据
   * @return 原值对象 list
   */
  List<HiolabsGalleryVO> convertBackstageToVoList(List<BackstageGalleryDataVO> gallery);

  /**
   * 后台画廊数据转换为原对象
   *
   * @param gallery 画廊数据
   * @return 原值对象
   */
  @Mapping(source = "gallery.url", target = "imgUrl")
  HiolabsGoodsGallery convertBackstageToPo(BackstageGalleryDataVO gallery);
  /**
   * 后台画廊数据转换为原对象list
   *
   * @param gallery 画廊数据
   * @return 原值对象 list
   */
  List<HiolabsGoodsGallery> convertBackstageToPoList(List<BackstageGalleryDataVO> gallery);
  /**
   * 后台画廊列表值对象
   *
   * @param gallery 原 po 类列表
   * @return 列表值对象
   */
  List<BackstageGalleryDataVO> convertToBackstageGalleryDataVoList(List<HiolabsGalleryVO> gallery);
}
